What will the above program write out?

Answer:

Important date on:  Saturday

Steps in a LET Statement

Remember that when a LET statement executes, it goes through several steps:

A LET Statement

  1. Finds memory for each NEW variable in the statement. (If there are no new variables, this step does nothing.)
  2. Does the calculation on the RIGHT of the equal sign. (If there is nothing to calculate, it just uses the value that is there.)
  3. Replaces the contents of the variable to the LEFT of the equal sign with the result of the calculation.

LET statements used with subscripted variable are no exception. However, a bit of extra work is done to deal with the subscript:

LET WHICH = 6

      +-------  Step 1.  Memory is found for the variable HOTDATE$
      |
      |
LET HOTDATE$ = DAY$( WHICH )
             |     |
             |     |  
             |     +----- Step 2. A value is found for the expression on the RIGHT.
             |                    This now involves getting the value in WHICH,
             |                    then getting the value in DAY$(6), 
             |                    the string "Saturday"
             |
             +------ Step 3.  The value is copied into the variable HOTDATE$

This is easy enough with the above statement, but things can get much more complicated.

QUESTION 13:

Do things have to get more complicated?